/*
 * DefaultTreeNode.java
 */

package xq.ide.node;

import java.util.Enumeration;
import javax.swing.tree.TreeNode;
import org.apache.log4j.Logger;
import xq.util.LoggerUtil;

/**
 *
 * @author ThorntonRP
 */
public abstract class DataTreeNode implements TreeNode {

	private static final Logger logger = LoggerUtil.getClassLogger();

	final DataTreeNode parentNode;
	final Object nodeData;
	final int nodeIndex;

	public DataTreeNode(DataTreeNode parentNode, Object nodeData, int nodeIndex) {
		this.parentNode = parentNode;
		this.nodeData = nodeData;
		this.nodeIndex = nodeIndex;
	}
	
	@Override
	public abstract TreeNode getChildAt(int childIndex);

	@Override
	public abstract int getChildCount();

	@Override
	public TreeNode getParent() {
		return parentNode;
	}

	@Override
	public int getIndex(TreeNode node) {
		return ((DataTreeNode) node).nodeIndex;
	}

	@Override
	public abstract boolean getAllowsChildren();

	@Override
	public abstract boolean isLeaf();

	@Override
	public abstract Enumeration children();
}
